/**
 * 
 */
package com.logistics.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.logistics.Courier;
import com.logistics.CourierQueryParam;
import com.logistics.admin.AdminGenericBaseAction;
import com.logistics.service.CourierService;

/**
 * @author hzz
 *
 * 2014年5月12日
 */

@Component("courierAdminAction")
@Scope("prototype")
public class CourierAdminAction extends AdminGenericBaseAction<Courier, CourierService> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2718072192657525621L;

	private CourierService service;
	
	@Autowired
	public void setService(CourierService service) {
		this.service = service;
	}

	@Override
	public CourierService getService() {
		return service;
	}

	private Courier courier;
	
	public Courier getCourier() {
		return courier;
	}

	public void setCourier(Courier courier) {
		this.courier = courier;
	}
	
	private List<Courier> couriers;

	public List<Courier> getCouriers() {
		return couriers;
	}

	public void setCouriers(List<Courier> couriers) {
		this.couriers = couriers;
	}

	private CourierQueryParam param;
	
	public CourierQueryParam getParam() {
		return param;
	}

	public void setParam(CourierQueryParam param) {
		this.param = param;
	}
	
	public String list(){
		if (param == null) {
			param = new CourierQueryParam();
		}
		
		param.setPaging(getPaging());
		
		couriers = service.query(param);
		
		return LIST;
	}

	@Override
	protected Courier initEntityForAdd() {
		return courier;
	}
	
	@Override
	protected void initEditForm() {
		courier = service.getById(getId());
	}

}
